/*
package com.css.common.core.utils;

import cn.hutool.json.JSONUtil;
import com.alibaba.fastjson.JSONObject;
import com.invoice.tcc.BO.*;
import com.invoice.tcc.BO.ylsw.CityInfoVO;
import com.invoice.tcc.BO.ylsw.YlswYhkRep;
import com.invoice.tcc.BO.ylsw.YlswYhkReq;
import com.invoice.tcc.cons.AppConstant;
import com.invoice.tcc.enums.SfcdfEnum;
import com.invoice.tcc.enums.YwlxEnum;
import com.invoice.tcc.exception.RequestFailException;
import com.invoice.tcc.exception.ServiceException;
import com.invoice.tcc.feign.YlCommonSsClient;
import com.invoice.tcc.service.YlswGyService;
import com.invoice.tcc.util.yl.YlswUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.math.BigDecimal;

*/
/**
 * @description: 银联支付工具类
 * @Title: YlzfUtil
 * @Author xlw
 * @Package com.invoice.util
 * @Date 2024/7/20 16:49
 *//*

@Slf4j
@Component
public class YlzfUtil {

    @Resource
    private YlCommonSsClient ylCommonSsClient;

    @Resource
    private YlswGyService ylswGyService;

    */
/**
     * 获取转账金额
     *
     * @param ywlxDm  业务类型代码
     * @param bhsje   b不含税金额
     * @param hsje    函数金额
     * @param sfcdfDm 税费承担方代码
     *//*

    public static BigDecimal countZzje(String ywlxDm, BigDecimal bhsje, BigDecimal hsje, String sfcdfDm) {
        BigDecimal zzje = BigDecimal.ZERO;
        if (YwlxEnum.YWLX_ZSZYHS.equals(ywlxDm)) {
            return hsje;
        }

        if (YwlxEnum.YWLX_LHYG.equals(ywlxDm)) {
            if (SfcdfEnum.SWCDF_QY.getDm().equals(sfcdfDm)) {
                zzje = bhsje;
            } else if (SfcdfEnum.SWCDF_ZRR.getDm().equals(sfcdfDm)) {
                zzje = hsje;
            }
        } else {
            zzje = bhsje;
        }
        return zzje;
    }

    */
/**
     * 查询余额
     *
     * @param request 请求
     * @return {@link YlyecxResponse }
     *//*

    public YlyecxResponse cxye(YlyecxRequest request) throws RequestFailException, ServiceException {
        log.info("查询余额请求入参:{}", JSONUtil.toJsonStr(request));
        YlyecxResponse response = ylCommonSsClient.cxye(request);
        if (AppConstant.YLXY_FAIL.equals(response.getResponseCode())) {
            //接口出错
            log.error("余额查询请求出错:{}", JSONUtil.toJsonStr(response));
            throw new RequestFailException(response.getResponseDesc());
        } else if (AppConstant.YLXY_SUCCESS.equals(response.getResponseCode())) {
            log.info("余额查询响应:{}", JSONUtil.toJsonStr(response));
            return response;
        }
        throw new ServiceException("请求余额查询接口报错");
    }

    */
/**
     * 银联支付
     *
     * @param request 请求
     * @return {@link YlzfResponse }
     *//*

    public YlzfResponse ylzf(YlzfRequest request) throws RequestFailException, ServiceException {
        log.info("支付请求入参:{}", JSONUtil.toJsonStr(request));
        YlzfResponse response = ylCommonSsClient.ylzf(request);
        if (AppConstant.YLXY_FAIL.equals(response.getResponseCode())) {
            //接口出错
            log.error("支付请求出错:{}", JSONUtil.toJsonStr(response));
            throw new RequestFailException(response.getResponseDesc());
        } else if (AppConstant.YLXY_SUCCESS.equals(response.getResponseCode())) {
            log.info("支付响应:{}", JSONUtil.toJsonStr(response));
            return response;
        }
        throw new ServiceException("请求支付接口报错");
    }

    */
/**
     * 支付状态查询
     *
     * @param request 请求
     * @return {@link YlfkztResponse }
     *//*

    public YlfkztResponse zfzt(YlfkztRequest request) throws RequestFailException, ServiceException {
        log.info("转账状态查询请求入参:{}", JSONUtil.toJsonStr(request));
        YlfkztResponse response = ylCommonSsClient.ylfkzt(request);
        if (AppConstant.YLXY_FAIL.equals(response.getResponseCode())) {
            //接口出错
            log.error("转账状态查询出错:{}", JSONUtil.toJsonStr(response));
            throw new RequestFailException(response.getResponseDesc());
        } else if (AppConstant.YLXY_SUCCESS.equals(response.getResponseCode())) {
            log.info("转账状态查询响应:{}", JSONUtil.toJsonStr(response));
            return response;
        }
        throw new ServiceException("转账状态查询接口报错");
    }

    public YlfkztResponse zfzt2(YlfkztRequest request) throws RequestFailException, ServiceException {
        log.info("转账状态查询请求入参:{}", JSONUtil.toJsonStr(request));
        YlfkztResponse response = ylCommonSsClient.ylfkzt(request);
        log.info("转账状态查询响应:{}", JSONUtil.toJsonStr(response));
        return response;
    }

    */
/**
     * 银行省级代码
     *
     * @param yhkh 银行卡号
     * @return {@link String }
     *//*

    public String bankProvincialCode(String yhkh) {
        final YlswYhkReq req = new YlswYhkReq();
        req.setCardNo(yhkh);
        try {
            final YlswYhkRep rep = ylswGyService.queryYhkfksd(req);
            log.info("调用银行卡发票属地查询接口返回YlswYhkRep:{}", JSONObject.toJSONString(rep));
            if (YlswUtils.YHK_SUCCESS_CODE.equalsIgnoreCase(rep.getErrCode())) {
                final CityInfoVO cityInfo = rep.getData().getCityInfo().get(0);
                if (GyUtils.isNotNull(cityInfo)) {
                    final String areaCode = cityInfo.getAreaCode();
                    if (GyUtils.isNotNull(areaCode)) {
                        String ssjxzqhDm = areaCode.substring(0, 2) + "0000";//取前2为拼接
                        return ssjxzqhDm;
                    }
                }
            }
        } catch (Exception e) {
            log.error("调用银行卡发票属地查询接口异常", e);
        }
        return null;
    }
}
*/
